<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ include file="../../commons/import_taglibs.jsp" %>
<table class="table table-striped table-bordered table-hover" id="dataTables-example">
    <colgroup>
        <col width="5%"/>
        <col width="15%"/>
        <col width="25%"/>
        <col width="20%"/>
        <col width="10%"/>
        <col width="15%"/>
        <col width="10%"/>
    </colgroup>
    <thead>
    <tr>
        <th style="text-align: center; ">&nbsp;</th>
        <th style="text-align: center; ">项目</th>
        <th style="text-align: center; ">路径</th>
        <th style="text-align: center; ">备注</th>
        <th style="text-align: center; ">操作人</th>
        <th style="text-align: center; ">时间</th>
        <th style="text-align: center; ">操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${pagination.result}" var="info" varStatus="status">
        <tr class="gradeU">
            <td align="center">
                ${pagination.offset + status.index + 1}
            </td>
            <td>${info.projectName}</td>
            <td class="nowrap">
                ${info.projectPath}
                <br>
                ${info.backupPath}
            </td>
            <td class="nowrap">${info.desc}</td>
            <td align="center">${info.operateUserName}</td>
            <td align="center">${info.operateTime}</td>
            <td align="center">
                <button type="button" class="btn btn-info" onclick="detailShow(${info.id});">详情</button>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>


<!-- 分页 -->
<ul class="pagination pull-left" style="margin: 0">

    <!-- 首页 -->
    <li class="paginate_button previous ${pagination.pageNumber <= 1 ? 'disabled' : ''}" aria-controls="dataTables-example" tabindex="0" id="dataTables-example_previous">
        <c:if test="${pagination.pageNumber <= 1}">
            <a>首页</a>
        </c:if>
        <c:if test="${pagination.pageNumber > 1}">
            <a href="javascript:queryPage(1);">首页</a>
        </c:if>
    </li>

    <!-- 上一页 -->
    <li class="paginate_button previous ${pagination.pageNumber <= 1 ? 'disabled' : ''}" aria-controls="dataTables-example" tabindex="0" id="dataTables-example_previous">
        <c:if test="${pagination.pageNumber <= 1}">
            <a>上一页</a>
        </c:if>
        <c:if test="${pagination.pageNumber > 1}">
            <a href="javascript:queryPage(${pagination.pageNumber - 1});">上一页</a>
        </c:if>
    </li>

    <!-- 页码 -->
    <c:forEach begin="1" end="${pagination.biggestPageNumber}" var="pageIdx">
        <li class="paginate_button ${pagination.pageNumber == pageIdx ? 'active' : ''}" aria-controls="dataTables-example"
            tabindex="0">
            <c:if test="${pagination.pageNumber == pageIdx}">
                <a>${pageIdx}</a>
            </c:if>
            <c:if test="${pagination.pageNumber != pageIdx}">
                <a href="javascript:queryPage(${pageIdx});">${pageIdx}</a>
            </c:if>
        </li>
    </c:forEach>

    <!-- 下一页 -->
    <li class="paginate_button next ${pagination.pageNumber == pagination.biggestPageNumber ? 'disabled' : ''}" aria-controls="dataTables-example" tabindex="0" id="dataTables-example_next">
        <c:if test="${pagination.pageNumber >= pagination.biggestPageNumber}">
            <a>下一页</a>
        </c:if>
        <c:if test="${pagination.pageNumber < pagination.biggestPageNumber}">
            <a href="javascript:queryPage(${pagination.pageNumber + 1});">下一页</a>
        </c:if>
    </li>

    <!-- 末页 -->
    <li class="paginate_button next ${pagination.pageNumber == pagination.biggestPageNumber ? 'disabled' : ''}" aria-controls="dataTables-example" tabindex="0" id="dataTables-example_next">
        <c:if test="${pagination.pageNumber >= pagination.biggestPageNumber}">
            <a>末页</a>
        </c:if>
        <c:if test="${pagination.pageNumber < pagination.biggestPageNumber}">
            <a href="javascript:queryPage(${pagination.biggestPageNumber});">末页</a>
        </c:if>
    </li>
</ul>

<script>
    /**
     * 查看详情
     * @param _infoId
     */
    function detailShow(_infoId) {
        $.get("/deploy/info/load/" + _infoId, function (data) {
            var fullFrame = layer.open({
                type: 1,
                content: "<div>" + data.info.log + "</div>",
                maxmin: true
            });
            layer.full(fullFrame);
        });
    }

    $(function () {
        $(".nowrap").mouseover(function () {
            var that = $(this);
            layer.tips("点击查看详情！", that, {
                tips: [1, '#3595CC'],
                width: 500
            });
        });
        $(".nowrap").mouseout(function () {
            layer.closeAll('tips');
        });

        $(".nowrap").click(function () {
            layer.open({
                type: 1,
                title: false,
                closeBtn: 1,
                shadeClose: true,
                closeBtn: false,
                content: '<div class="col-lg-12" style="padding: 20px;">' + $(this).html() + '</div>'
            });
        });
    });
</script>